home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6184 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: sscanf bug??????
  5. Date: Thu, 22 Feb 96 23:45:00 GMT
  6. Organization: none
  7. Message-ID: <825032700snz@genesis.demon.co.uk>
  8. References: <4fimvo$82s@fnord.dfw.net> <4fqfeo$7mh@umbc9.umbc.edu> <4gh7dc$i2@mailhub.scitec.com.au>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4gh7dc$i2@mailhub.scitec.com.au>
  15.            ramsesy@rd.scitec.com.au "Ramses Youhana" writes:
  16.  
  17. >It is also good practice to specify the parameters to a function and its
  18. >return values.  This forces an ANSI-C compiler to perform some degree of
  19. >parameter and return type checking, hopefully picking up some bugs at
  20. >compile time and saving you from lots of headaches during debugging.
  21. >
  22. >E.g.
  23. >
  24. >int  main (void)
  25. >
  26. >instead of
  27. >
  28. >main()
  29.  
  30. I agree that:
  31.  
  32. int main(void)
  33.  
  34. is by far the best way of writing this. However for complete accuracy:
  35.  
  36.  
  37. int main(void)
  38.  
  39. and
  40.  
  41. main(void)
  42.  
  43. both specify a function that takes no arguments and returns int. Exactly
  44. the same amount of compiler checking is required by the C language in
  45. both cases.
  46.  
  47. -- 
  48. -----------------------------------------
  49. Lawrence Kirby | fred@genesis.demon.co.uk
  50. Wilts, England | 70734.126@compuserve.com
  51. -----------------------------------------
  52.